Action hook 'customize_preview_{$this->type}'

in WP Core File wp-includes/class-wp-customize-setting.php at line 417

View Source

customize_preview_{$this->type}

Action Hook
Description
Fires when the WP_Customize_Setting::preview() method is called for settings not handled as theme_mods or options. The dynamic portion of the hook name, `$this->type`, refers to the setting type.

Hook Information

File Location wp-includes/class-wp-customize-setting.php View on GitHub
Hook Type Action
Line Number 417

Hook Parameters

Type Name Description
WP_Customize_Setting $setting WP_Customize_Setting instance.

Usage Examples

Basic Usage
<?php
// Hook into customize_preview_{$this->type}
add_action('customize_preview_{$this->type}', 'my_custom_function', 10, 1);

function my_custom_function($setting) {
    // Your custom code here
}

Source Code Context

wp-includes/class-wp-customize-setting.php:417 - How this hook is used in WordPress core
<?php
 412  				 *
 413  				 * @since 4.1.0
 414  				 *
 415  				 * @param WP_Customize_Setting $setting WP_Customize_Setting instance.
 416  				 */
 417  				do_action( "customize_preview_{$this->type}", $this );
 418  		}
 419  
 420  		$this->is_previewed = true;
 421  
 422  		return true;

PHP Documentation

<?php
/**
				 * Fires when the WP_Customize_Setting::preview() method is called for settings
				 * not handled as theme_mods or options.
				 *
				 * The dynamic portion of the hook name, `$this->type`, refers to the setting type.
				 *
				 * @since 4.1.0
				 *
				 * @param WP_Customize_Setting $setting WP_Customize_Setting instance.
				 */
Quick Info
  • Hook Type: Action
  • Parameters: 1
  • File: wp-includes/class-wp-customize-setting.php
Related Hooks

Related hooks will be displayed here in future updates.